home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC / include / afxole.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  66.8 KB  |  1,961 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. #ifndef __AFXOLE_H__
  12. #define __AFXOLE_H__
  13.  
  14. #ifdef _AFX_NO_OLE_SUPPORT
  15.     #error OLE classes not supported in this library variant.
  16. #endif
  17.  
  18. #ifndef __AFXEXT_H__
  19.     #include <afxext.h>
  20. #endif
  21.  
  22. #ifndef __AFXDISP_H__
  23.     #include <afxdisp.h>
  24. #endif
  25.  
  26. // include OLE Compound Document headers
  27. #ifndef _OLE2_H_
  28.     #include <ole2.h>
  29. #endif
  30.  
  31. // ActiveX Document support
  32. #ifndef __docobj_h__
  33.     #include <docobj.h>
  34. #endif
  35.  
  36. // URL Monikers support
  37. #ifndef __urlmon_h__
  38.     #include <urlmon.h>
  39. #endif
  40.  
  41. #ifndef __AFXCOM_H__
  42. #include <afxcom_.h>
  43. #endif
  44.  
  45. #ifdef _AFX_MINREBUILD
  46. #pragma component(minrebuild, off)
  47. #endif
  48. #ifndef _AFX_FULLTYPEINFO
  49. #pragma component(mintypeinfo, on)
  50. #endif
  51.  
  52. #ifdef _AFX_PACKING
  53. #pragma pack(push, _AFX_PACKING)
  54. #endif
  55.  
  56.  
  57. #ifndef _AFX_NOFORCE_LIBS
  58.  
  59. #if !defined(_WIN32_WCE)
  60. #pragma comment(lib, "urlmon.lib")
  61. #endif // _WIN32_WCE
  62.  
  63. #endif // !_AFX_NOFORCE_LIBS
  64.  
  65. /////////////////////////////////////////////////////////////////////////////
  66. // AFXOLE.H - MFC OLE support
  67.  
  68. // Classes declared in this file
  69.  
  70. //CDocument
  71.     class COleDocument;             // OLE container document
  72.         class COleLinkingDoc;       // supports links to embeddings
  73.             class COleServerDoc;    // OLE server document
  74.     class CDocObjectServer;         // might be owned by a COleServerDoc
  75.  
  76. //CCmdTarget
  77.     class CDocItem;                 // part of a document
  78.         class COleClientItem;       // embedded ole object from outside
  79.             class COleDocObjectItem;// ActiveX Document item
  80.         class COleServerItem;       // ole object to export
  81.     class COleDataSource;           // clipboard data source mechanism
  82.     class COleDropSource;           // drag/drop source
  83.     class COleDropTarget;           // drag/drop target
  84.     class COleMessageFilter;        // concurrency management
  85.  
  86. //CFrameWnd
  87.     class COleIPFrameWnd;           // frame window for in-place servers
  88.  
  89. //CControlBar
  90.     class COleResizeBar;            // implements in-place resizing
  91.  
  92. //CFile
  93.     class COleStreamFile;           // CFile wrapper for IStream interface
  94.         class CMonikerFile;         // bound to via IMoniker
  95.             class CAsyncMonikerFile;// asynchronous IMoniker
  96.  
  97. class COleDataObject;               // wrapper for IDataObject interface
  98.  
  99. /////////////////////////////////////////////////////////////////////////////
  100.  
  101. // AFXDLL support
  102. #undef AFX_DATA
  103. #define AFX_DATA AFX_OLE_DATA
  104.  
  105. /////////////////////////////////////////////////////////////////////////////
  106. // backward compatibility
  107.  
  108. // COleClientDoc is now obsolete -- use COleDocument instead
  109. #define COleClientDoc COleDocument
  110.  
  111. // COleServer has been replaced by the more general COleObjectFactory
  112. #define COleServer  COleObjectFactory
  113.  
  114. /////////////////////////////////////////////////////////////////////////////
  115. // Useful OLE specific types (some from OLE 1.0 headers)
  116.  
  117. // Codes for CallBack events
  118. enum OLE_NOTIFICATION
  119. {
  120.     OLE_CHANGED,        // representation of a draw aspect has changed
  121.     OLE_SAVED,          // the item has committed its storage
  122.     OLE_CLOSED,         // the item has closed
  123.     OLE_RENAMED,        // the item has changed its moniker
  124.     OLE_CHANGED_STATE,  // the item state (open, active, etc.) has changed
  125.     OLE_CHANGED_ASPECT, // the item draw aspect has changed
  126. };
  127.  
  128. // Object types
  129. enum OLE_OBJTYPE
  130. {
  131.     OT_UNKNOWN = 0,
  132.  
  133.     // These are OLE 1.0 types and OLE 2.0 types as returned from GetType().
  134.     OT_LINK = 1,
  135.     OT_EMBEDDED = 2,
  136.     OT_STATIC = 3,
  137.  
  138.     // All OLE2 objects are written with this tag when serialized.  This
  139.     //  differentiates them from OLE 1.0 objects written with MFC 2.0.
  140.     //  This value will never be returned from GetType().
  141.     OT_OLE2 = 256,
  142. };
  143.  
  144. #if !defined(_WIN32_WCE)
  145. /////////////////////////////////////////////////////////////////////////////
  146. // COleDataObject -- simple wrapper for IDataObject
  147.  
  148. class COleDataObject
  149. {
  150. // Constructors
  151. public:
  152.     COleDataObject();
  153.  
  154. // Operations
  155.     void Attach(LPDATAOBJECT lpDataObject, BOOL bAutoRelease = TRUE);
  156.     LPDATAOBJECT Detach();  // detach and get ownership of m_lpDataObject
  157.     void Release(); // detach and Release ownership of m_lpDataObject
  158.     BOOL AttachClipboard(); // attach to current clipboard object
  159.  
  160. // Attributes
  161.     void BeginEnumFormats();
  162.     BOOL GetNextFormat(LPFORMATETC lpFormatEtc);
  163.     CFile* GetFileData(CLIPFORMAT cfFormat, LPFORMATETC lpFormatEtc = NULL);
  164.     HGLOBAL GetGlobalData(CLIPFORMAT cfFormat, LPFORMATETC lpFormatEtc = NULL);
  165.     BOOL GetData(CLIPFORMAT cfFormat, LPSTGMEDIUM lpStgMedium,
  166.         LPFORMATETC lpFormatEtc = NULL);
  167.     BOOL IsDataAvailable(CLIPFORMAT cfFormat, LPFORMATETC lpFormatEtc = NULL);
  168.  
  169. // Implementation
  170. public:
  171.     LPDATAOBJECT m_lpDataObject;
  172.     LPENUMFORMATETC m_lpEnumerator;
  173.     ~COleDataObject();
  174.  
  175.     // advanced use and implementation
  176.     LPDATAOBJECT GetIDataObject(BOOL bAddRef);
  177.     void EnsureClipboardObject();
  178.     BOOL m_bClipboard;      // TRUE if represents the Win32 clipboard
  179.  
  180. protected:
  181.     BOOL m_bAutoRelease;    // TRUE if destructor should call Release
  182.  
  183. private:
  184.     // Disable the copy constructor and assignment by default so you will get
  185.     //   compiler errors instead of unexpected behaviour if you pass objects
  186.     //   by value or assign objects.
  187.     COleDataObject(const COleDataObject&);  // no implementation
  188.     void operator=(const COleDataObject&);  // no implementation
  189. };
  190. #endif // _WIN32_WCE
  191.  
  192. /////////////////////////////////////////////////////////////////////////////
  193. // COleDataSource -- wrapper for implementing IDataObject
  194. //  (works similar to how data is provided on the clipboard)
  195.  
  196. struct AFX_DATACACHE_ENTRY;
  197. class COleDropSource;
  198.  
  199. class COleDataSource : public CCmdTarget
  200. {
  201. // Constructors
  202. public:
  203.     COleDataSource();
  204.  
  205. // Operations
  206.     void Empty();   // empty cache (similar to ::EmptyClipboard)
  207.  
  208.     // CacheData & DelayRenderData operations similar to ::SetClipboardData
  209.     void CacheGlobalData(CLIPFORMAT cfFormat, HGLOBAL hGlobal,
  210.         LPFORMATETC lpFormatEtc = NULL);    // for HGLOBAL based data
  211.     void DelayRenderFileData(CLIPFORMAT cfFormat,
  212.         LPFORMATETC lpFormatEtc = NULL);    // for CFile* based delayed render
  213.  
  214.     // Clipboard and Drag/Drop access
  215.     DROPEFFECT DoDragDrop(
  216.         DWORD dwEffects = DROPEFFECT_COPY|DROPEFFECT_MOVE|DROPEFFECT_LINK,
  217.         LPCRECT lpRectStartDrag = NULL,
  218.         COleDropSource* pDropSource = NULL);
  219.     void SetClipboard();
  220.     static void PASCAL FlushClipboard();
  221.     static COleDataSource* PASCAL GetClipboardOwner();
  222.  
  223.     // Advanced: STGMEDIUM based cached data
  224.     void CacheData(CLIPFORMAT cfFormat, LPSTGMEDIUM lpStgMedium,
  225.         LPFORMATETC lpFormatEtc = NULL);    // for LPSTGMEDIUM based data
  226.     // Advanced: STGMEDIUM or HGLOBAL based delayed render
  227.     void DelayRenderData(CLIPFORMAT cfFormat, LPFORMATETC lpFormatEtc = NULL);
  228.  
  229.     // Advanced: support for SetData in COleServerItem
  230.     //  (not generally useful for clipboard or drag/drop operations)
  231.     void DelaySetData(CLIPFORMAT cfFormat, LPFORMATETC lpFormatEtc = NULL);
  232.  
  233. // Overidables
  234.     virtual BOOL OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* phGlobal);
  235.     virtual BOOL OnRenderFileData(LPFORMATETC lpFormatEtc, CFile* pFile);
  236.     virtual BOOL OnRenderData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium);
  237.         // OnRenderFileData and OnRenderGlobalData are called by
  238.         //  the default implementation of OnRenderData.
  239.  
  240.     virtual BOOL OnSetData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium,
  241.         BOOL bRelease);
  242.         // used only in COleServerItem implementation
  243.  
  244. // Implementation
  245. public:
  246.     virtual ~COleDataSource();
  247. #ifdef _DEBUG
  248.     virtual void AssertValid() const;
  249.     virtual void Dump(CDumpContext& dc) const;
  250. #endif
  251.  
  252. protected:
  253.     AFX_DATACACHE_ENTRY* m_pDataCache;  // data cache itself
  254.     UINT m_nMaxSize;    // current allocated size
  255.     UINT m_nSize;       // current size of the cache
  256.     UINT m_nGrowBy;     // number of cache elements to grow by for new allocs
  257.  
  258.     AFX_DATACACHE_ENTRY* Lookup(
  259.         LPFORMATETC lpFormatEtc, DATADIR nDataDir) const;
  260.     AFX_DATACACHE_ENTRY* GetCacheEntry(
  261.         LPFORMATETC lpFormatEtc, DATADIR nDataDir);
  262.  
  263. // Interface Maps
  264. public:
  265.     BEGIN_INTERFACE_PART(DataObject, IDataObject)
  266.         INIT_INTERFACE_PART(COleDataSource, DataObject)
  267.         STDMETHOD(GetData)(LPFORMATETC, LPSTGMEDIUM);
  268.         STDMETHOD(GetDataHere)(LPFORMATETC, LPSTGMEDIUM);
  269.         STDMETHOD(QueryGetData)(LPFORMATETC);
  270.         STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC, LPFORMATETC);
  271.         STDMETHOD(SetData)(LPFORMATETC, LPSTGMEDIUM, BOOL);
  272.         STDMETHOD(EnumFormatEtc)(DWORD, LPENUMFORMATETC*);
  273.         STDMETHOD(DAdvise)(LPFORMATETC, DWORD, LPADVISESINK, LPDWORD);
  274.         STDMETHOD(DUnadvise)(DWORD);
  275.         STDMETHOD(EnumDAdvise)(LPENUMSTATDATA*);
  276.     END_INTERFACE_PART(DataObject)
  277.  
  278.     DECLARE_INTERFACE_MAP()
  279.  
  280.     friend class COleServerItem;
  281. };
  282.  
  283. #if !defined(_WIN32_WCE)
  284. //////////////////////////////////////////////////////////////////////////////
  285. // DocItem support
  286.  
  287. #ifdef _AFXDLL
  288. class CDocItem : public CCmdTarget
  289. #else
  290. class AFX_NOVTABLE CDocItem : public CCmdTarget
  291. #endif
  292. {
  293.     DECLARE_SERIAL(CDocItem)
  294.  
  295. // Constructors
  296. protected:      // abstract class
  297.     CDocItem();
  298.  
  299. // Attributes
  300. public:
  301.     CDocument* GetDocument() const; // return container document
  302.  
  303. // Overridables
  304. public:
  305.     // Raw data access (native format)
  306.     virtual BOOL IsBlank() const;
  307.  
  308. // Implementation
  309. protected:
  310.     COleDocument* m_pDocument;
  311.  
  312. public:
  313.     virtual void Serialize(CArchive& ar);   // for Native data
  314.     virtual ~CDocItem();
  315. #ifdef _DEBUG
  316.     virtual void AssertValid() const;
  317.     virtual void Dump(CDumpContext& dc) const;
  318. #endif
  319.  
  320.     friend class COleDocument;              // for access to back pointer
  321. };
  322.  
  323. //////////////////////////////////////////////////////////////////////////////
  324. // COleDocument - common OLE container behavior (enables server functionality)
  325.  
  326. class COleDocument : public CDocument
  327. {
  328.     DECLARE_DYNAMIC(COleDocument)
  329.  
  330. // Constructors
  331. public:
  332.     COleDocument();
  333.  
  334. // Attributes
  335.     BOOL HasBlankItems() const; // check for BLANK items
  336.     virtual COleClientItem* GetInPlaceActiveItem(CWnd* pWnd);
  337.         // return in-place active item for this view or NULL if none
  338.  
  339. // Operations
  340.     // iterating over existing items
  341.     virtual POSITION GetStartPosition() const;
  342.     virtual CDocItem* GetNextItem(POSITION& pos) const;
  343.  
  344.     // iterator helpers (helpers use virtual GetNextItem above)
  345.     COleClientItem* GetNextClientItem(POSITION& pos) const;
  346.     COleServerItem* GetNextServerItem(POSITION& pos) const;
  347.  
  348.     // adding new items - called from item constructors
  349.     virtual void AddItem(CDocItem* pItem);
  350.     virtual void RemoveItem(CDocItem* pItem);
  351.  
  352.     void EnableCompoundFile(BOOL bEnable = TRUE);
  353.         // enable compound file support (only call during constructor)
  354.     virtual void UpdateModifiedFlag();
  355.         // scan for modified items -- mark document modified
  356.  
  357.     // printer-device caching/control
  358.     BOOL ApplyPrintDevice(const DVTARGETDEVICE* ptd);
  359.     BOOL ApplyPrintDevice(const PRINTDLG* ppd);
  360.         // these apply the target device to all COleClientItem objects
  361.  
  362. // Overridables
  363.     virtual COleClientItem* GetPrimarySelectedItem(CView* pView);
  364.         // return primary selected item or NULL if none
  365.     virtual void OnShowViews(BOOL bVisible);
  366.         // called during app-idle when visibility of a document has changed
  367.  
  368. // Implementation
  369. public:
  370.     CObList m_docItemList;  // not owned items
  371.  
  372. #ifdef _DEBUG
  373.     virtual void AssertValid() const;
  374.     virtual void Dump(CDumpContext& dc) const;
  375. #endif
  376.     CFrameWnd* GetFirstFrame();
  377.  
  378.     // document handling overrides
  379.     virtual void SetPathName(LPCTSTR lpszPathName, BOOL bAddToMRU = TRUE);
  380.     virtual ~COleDocument();
  381.     virtual void DeleteContents(); // delete client items in list
  382.     virtual void Serialize(CArchive& ar);   // serialize items to file
  383.     virtual void PreCloseFrame(CFrameWnd* pFrame);
  384.     virtual BOOL SaveModified();
  385.     virtual void OnIdle();
  386.  
  387.     // compound file implementation
  388.     virtual BOOL OnNewDocument();
  389.     virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
  390.     virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
  391.     virtual void OnCloseDocument();
  392.     void CommitItems(BOOL bSuccess);    // called during File.Save & File.Save As
  393.  
  394.     // minimal linking protocol
  395.     virtual LPMONIKER GetMoniker(OLEGETMONIKER nAssign);
  396.     virtual LPOLEITEMCONTAINER GetContainer();
  397.  
  398. protected:
  399.     // document state implementation
  400.     UINT m_dwNextItemNumber;// serial number for next item in this document
  401.     BOOL m_bLastVisible;    // TRUE if one or more views was last visible
  402.  
  403.     // 'docfile' support
  404.     BOOL m_bCompoundFile;   // TRUE if use compound files
  405.     LPSTORAGE m_lpRootStg;  // root storage for the document
  406.     BOOL m_bSameAsLoad;     // TRUE = file-save, FALSE = Save [Copy] As
  407.     BOOL m_bRemember;       // if FALSE, indicates Save Copy As
  408.  
  409.     DVTARGETDEVICE* m_ptd;  // current document target device
  410.  
  411.     // implementation helpers
  412.     virtual void LoadFromStorage();
  413.     virtual void SaveToStorage(CObject* pObject = NULL);
  414.     CDocItem* GetNextItemOfKind(POSITION& pos, CRuntimeClass* pClass) const;
  415.  
  416.     // command handling
  417. public:
  418.     virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,
  419.         AFX_CMDHANDLERINFO* pHandlerInfo);
  420.  
  421. protected:
  422.     afx_msg void OnUpdatePasteMenu(CCmdUI* pCmdUI);
  423.     afx_msg void OnUpdatePasteLinkMenu(CCmdUI* pCmdUI);
  424.     afx_msg void OnUpdateEditLinksMenu(CCmdUI* pCmdUI);
  425.     afx_msg void OnEditLinks();
  426.     afx_msg void OnEditConvert();
  427.     afx_msg void OnUpdateEditChangeIcon(CCmdUI* pCmdUI);
  428.     afx_msg void OnEditChangeIcon();
  429.     afx_msg void OnUpdateObjectVerbMenu(CCmdUI* pCmdUI);
  430.     afx_msg void OnFileSendMail();
  431.  
  432.     friend class COleClientItem;
  433.     friend class COleServerItem;
  434. };
  435.  
  436. /////////////////////////////////////////////////////////////////////////////
  437. // COleClientItem - Supports OLE2 non-inplace editing.
  438. //      implements IOleClientSite, IAdviseSink, and IOleInPlaceSite
  439.  
  440. class COleFrameHook;    // forward reference (see ..\src\oleimpl2.h)
  441.  
  442. class COleClientItem : public CDocItem
  443. {
  444.     DECLARE_DYNAMIC(COleClientItem)
  445.  
  446. // Constructors
  447. public:
  448.     COleClientItem(COleDocument* pContainerDoc = NULL);
  449.  
  450.     // create from the clipboard
  451.     BOOL CreateFromClipboard(OLERENDER render = OLERENDER_DRAW,
  452.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  453.     BOOL CreateLinkFromClipboard(OLERENDER render = OLERENDER_DRAW,
  454.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  455.     BOOL CreateStaticFromClipboard(OLERENDER render = OLERENDER_DRAW,
  456.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  457.  
  458.     // create from a class ID (Insert New Object dialog)
  459.     BOOL CreateNewItem(REFCLSID clsid, OLERENDER render = OLERENDER_DRAW,
  460.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  461.  
  462.     // create from COleDataObject
  463.     BOOL CreateFromData(COleDataObject* pDataObject,
  464.         OLERENDER render = OLERENDER_DRAW,
  465.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  466.     BOOL CreateLinkFromData(COleDataObject* pDataObject,
  467.         OLERENDER render = OLERENDER_DRAW,
  468.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  469.     BOOL CreateStaticFromData(COleDataObject* pDataObject,
  470.         OLERENDER render = OLERENDER_DRAW,
  471.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  472.  
  473.     // create from file (package support)
  474.     BOOL CreateFromFile(LPCTSTR lpszFileName, REFCLSID clsid = CLSID_NULL,
  475.         OLERENDER render = OLERENDER_DRAW,
  476.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  477.     BOOL CreateLinkFromFile(LPCTSTR lpszFileName,
  478.         OLERENDER render = OLERENDER_DRAW,
  479.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  480.  
  481.     // create a copy
  482.     BOOL CreateCloneFrom(const COleClientItem* pSrcItem);
  483.  
  484. // General Attributes
  485. public:
  486.     HICON GetIconFromRegistry() const;
  487.     static HICON GetIconFromRegistry(CLSID& clsid);
  488.     SCODE GetLastStatus() const;
  489.     OLE_OBJTYPE GetType() const; // OT_LINK, OT_EMBEDDED, OT_STATIC
  490.     void GetClassID(CLSID* pClassID) const;
  491.     void GetUserType(USERCLASSTYPE nUserClassType, CString& rString);
  492.     BOOL GetExtent(LPSIZE lpSize, DVASPECT nDrawAspect = (DVASPECT)-1);
  493.         // will return FALSE if item is BLANK
  494.     BOOL GetCachedExtent(LPSIZE lpSize, DVASPECT nDrawAspect = (DVASPECT)-1);
  495.  
  496.     // getting/setting iconic cache
  497.     HGLOBAL GetIconicMetafile();
  498.     BOOL SetIconicMetafile(HGLOBAL hMetaPict);
  499.  
  500.     // setting/getting default display aspect
  501.     DVASPECT GetDrawAspect() const;
  502.     virtual void SetDrawAspect(DVASPECT nDrawAspect);
  503.  
  504.     // for printer presentation cache
  505.     BOOL SetPrintDevice(const DVTARGETDEVICE* ptd);
  506.     BOOL SetPrintDevice(const PRINTDLG* ppd);
  507.  
  508.     // Item state
  509.     enum ItemState
  510.         { emptyState, loadedState, openState, activeState, activeUIState };
  511.     UINT GetItemState() const;
  512.  
  513.     BOOL IsModified() const;
  514.     BOOL IsRunning() const;
  515.     BOOL IsInPlaceActive() const;
  516.     BOOL IsOpen() const;
  517.     CView* GetActiveView() const;
  518.  
  519.     // Data access
  520.     void AttachDataObject(COleDataObject& rDataObject) const;
  521.  
  522.     // other rare access information
  523.     COleDocument* GetDocument() const; // return container
  524.  
  525.     // helpers for checking clipboard data availability
  526.     static BOOL PASCAL CanPaste();
  527.     static BOOL PASCAL CanPasteLink();
  528.  
  529.     // helpers for checking COleDataObject, useful in drag drop
  530.     static BOOL PASCAL CanCreateFromData(const COleDataObject* pDataObject);
  531.     static BOOL PASCAL CanCreateLinkFromData(const COleDataObject* pDataObject);
  532.  
  533. // General Operations
  534.     virtual void Release(OLECLOSE dwCloseOption = OLECLOSE_NOSAVE);
  535.         // cleanup, detach (close if needed)
  536.     void Close(OLECLOSE dwCloseOption = OLECLOSE_SAVEIFDIRTY);
  537.         // close without releasing the item
  538.     void Delete(BOOL bAutoDelete = TRUE);
  539.         // logically delete from file -- not part of the document anymore
  540.     void Run(); // insure item is in running state
  541.  
  542.     // Drawing
  543.     BOOL Draw(CDC* pDC, LPCRECT lpBounds,
  544.         DVASPECT nDrawAspect = (DVASPECT)-1);   // defaults to m_nDrawAspect
  545.  
  546.     // Activation
  547.     virtual BOOL DoVerb(LONG nVerb, CView* pView, LPMSG lpMsg = NULL);
  548.     void Activate(LONG nVerb, CView* pView, LPMSG lpMsg = NULL);
  549.  
  550.     // In-place Activation
  551.     void Deactivate();          // completely deactivate
  552.     void DeactivateUI();        // deactivate the user interface
  553.     BOOL ReactivateAndUndo();   // reactivate then perform undo command
  554.     BOOL SetItemRects(LPCRECT lpPosRect = NULL, LPCRECT lpClipRect = NULL);
  555.     CWnd* GetInPlaceWindow();
  556.  
  557.     // Clipboard operations
  558.     void CopyToClipboard(BOOL bIncludeLink = FALSE);
  559.     DROPEFFECT DoDragDrop(LPCRECT lpItemRect, CPoint ptOffset,
  560.         BOOL bIncludeLink = FALSE,
  561.         DWORD dwEffects = DROPEFFECT_COPY|DROPEFFECT_MOVE,
  562.         LPCRECT lpRectStartDrag = NULL);
  563.     void GetClipboardData(COleDataSource* pDataSource,
  564.         BOOL bIncludeLink = FALSE, LPPOINT lpOffset = NULL,
  565.         LPSIZE lpSize = NULL);
  566.  
  567.     // called for creating a COleDataSource by CopyToClipboard and DoDragDrop
  568.     virtual COleDataSource* OnGetClipboardData(BOOL bIncludeLink,
  569.         LPPOINT lpOffset, LPSIZE lpSize);
  570.  
  571.     // Operations that apply to embedded items only
  572.     void SetHostNames(LPCTSTR lpszHost, LPCTSTR lpszHostObj);
  573.     void SetExtent(const CSize& size, DVASPECT nDrawAspect = DVASPECT_CONTENT);
  574.  
  575.     // Operations that apply to linked items only
  576.     //  (link options are rarely changed, except through Links dialog)
  577.     OLEUPDATE GetLinkUpdateOptions();
  578.     void SetLinkUpdateOptions(OLEUPDATE dwUpdateOpt);
  579.  
  580.     // Link-source update status (also useful for embeddings that contain links)
  581.     BOOL UpdateLink();  // make up-to-date
  582.     BOOL IsLinkUpToDate() const;    // is link up-to-date
  583.  
  584.     // object conversion
  585.     virtual BOOL ConvertTo(REFCLSID clsidNew);
  586.     virtual BOOL ActivateAs(LPCTSTR lpszUserType, REFCLSID clsidOld, REFCLSID clsidNew);
  587.     BOOL Reload();  // for lazy reload after ActivateAs
  588.  
  589. // Overridables (notifications of IAdviseSink, IOleClientSite and IOleInPlaceSite)
  590.     // Callbacks/notifications from the server you must/should implement
  591.     virtual void OnChange(OLE_NOTIFICATION nCode, DWORD dwParam);
  592.         // implement OnChange to invalidate when item changes
  593.  
  594. protected:
  595.     virtual void OnGetItemPosition(CRect& rPosition);
  596.         // implement OnGetItemPosition if you support in-place activation
  597.  
  598.     // Common overrides for in-place activation
  599.     virtual BOOL OnScrollBy(CSize sizeExtent);
  600.  
  601.     // Common overrides for applications supporting undo
  602.     virtual void OnDiscardUndoState();
  603.     virtual void OnDeactivateAndUndo();
  604.  
  605. public:
  606.     virtual void OnDeactivateUI(BOOL bUndoable);
  607.  
  608. protected:
  609.     // Common overrides for applications supporting links to embeddings
  610.     virtual void OnShowItem();
  611.  
  612.     // Advanced overrides for in-place activation
  613.     virtual void OnGetClipRect(CRect& rClipRect);
  614.     virtual BOOL CanActivate();
  615.  
  616. public:
  617.     virtual void OnActivate();
  618.     virtual void OnActivateUI();
  619.     virtual void OnDeactivate();
  620.  
  621. protected:
  622.     virtual BOOL OnGetWindowContext(CFrameWnd** ppMainFrame,
  623.         CFrameWnd** ppDocFrame, LPOLEINPLACEFRAMEINFO lpFrameInfo);
  624.     virtual BOOL OnChangeItemPosition(const CRect& rectPos);
  625.         // default calls SetItemRects and caches the pos rect
  626.  
  627. public:
  628.     // Advanced overrides for menu/title handling (rarely overridden)
  629.     virtual void OnInsertMenus(CMenu* pMenuShared,
  630.         LPOLEMENUGROUPWIDTHS lpMenuWidths);
  631.     virtual void OnSetMenu(CMenu* pMenuShared, HOLEMENU holemenu,
  632.         HWND hwndActiveObject);
  633.     virtual void OnRemoveMenus(CMenu* pMenuShared);
  634.     virtual BOOL OnUpdateFrameTitle();
  635.  
  636.     // Advanced override for control bar handling
  637.     virtual BOOL OnShowControlBars(CFrameWnd* pFrameWnd, BOOL bShow);
  638.  
  639. // Implementation
  640. public:
  641.     // data to support non-inplace activated items
  642.     LPOLEOBJECT m_lpObject; // in case you want direct access to the OLE object
  643.     LPVIEWOBJECT2 m_lpViewObject;// IViewObject for IOleObject above
  644.     DWORD m_dwItemNumber;   // serial number for this item in this document
  645.     DVASPECT m_nDrawAspect; // current default display aspect
  646.     SCODE m_scLast;         // last error code encountered
  647.     LPSTORAGE m_lpStorage;  // provides storage for m_lpObject
  648.     LPLOCKBYTES m_lpLockBytes;  // part of implementation of m_lpStorage
  649.     DWORD m_dwConnection;   // advise connection to the m_lpObject
  650.     BYTE m_bLinkUnavail;    // TRUE if link is currently unavailable
  651.     BYTE m_bMoniker;        // TRUE if moniker is assigned
  652.     BYTE m_bLocked;         // TRUE if object has external lock
  653.     BYTE m_bNeedCommit;     // TRUE if need CommitItem
  654.     BYTE m_bClosing;        // TRUE if currently doing COleClientItem::Close
  655.     BYTE m_bReserved[3];    // (reserved for future use)
  656.  
  657.     // for compound file support
  658.     LPSTORAGE m_lpNewStorage;   // used during Save As situations
  659.  
  660.     // item state & item type
  661.     ItemState m_nItemState; // item state (see ItemState enumeration)
  662.     OLE_OBJTYPE m_nItemType;    // item type (depends on how created)
  663.  
  664.     // data valid when in-place activated
  665.     CView* m_pView; // view when object is in-place activated
  666.     DWORD m_dwContainerStyle;   // style of the container wnd before activation
  667.     COleFrameHook* m_pInPlaceFrame;// frame window when in-place active
  668.     COleFrameHook* m_pInPlaceDoc;   // doc window when in-place (may be NULL)
  669.     HWND m_hWndServer;  // HWND of in-place server window
  670.  
  671. public:
  672.     virtual ~COleClientItem();
  673.     virtual void Serialize(CArchive& ar);
  674. #ifdef _DEBUG
  675.     virtual void AssertValid() const;
  676.     virtual void Dump(CDumpContext& dc) const;
  677. #endif
  678.  
  679. // Implementation
  680. public:
  681.     virtual BOOL ReportError(SCODE sc) const;
  682.     virtual BOOL FreezeLink();  // converts to static: for edit links dialog
  683.  
  684.     DWORD GetNewItemNumber();   // generates new item number
  685.     void GetItemName(LPTSTR lpszItemName) const; // gets readable item name
  686.  
  687.     void UpdateItemType();  // update m_nItemType
  688.  
  689. protected:
  690.     // clipboard helpers
  691.     void GetEmbeddedItemData(LPSTGMEDIUM lpStgMedium);
  692.     void AddCachedData(COleDataSource* pDataSource);
  693.     BOOL GetLinkSourceData(LPSTGMEDIUM lpStgMedium);
  694.     void GetObjectDescriptorData(LPPOINT lpOffset, LPSIZE lpSize,
  695.         LPSTGMEDIUM lpStgMedium);
  696.  
  697.     // interface helpers
  698.     virtual LPOLECLIENTSITE GetClientSite();
  699.  
  700.     // helpers for printer-cached representation
  701.     BOOL GetPrintDeviceInfo(LPOLECACHE* plpOleCache,
  702.         DVTARGETDEVICE** pptd, DWORD* pdwConnection);
  703.  
  704. // Advanced Overridables for implementation
  705. protected:
  706.     virtual BOOL FinishCreate(SCODE sc);
  707.     virtual void CheckGeneral(SCODE sc);
  708.  
  709.     virtual void OnDataChange(LPFORMATETC lpFormatEtc,
  710.         LPSTGMEDIUM lpStgMedium);
  711.  
  712. public:
  713.     // for storage hookability (override to use 'docfiles')
  714.     virtual void GetItemStorage();  // allocate storage for new item
  715.     virtual void ReadItem(CArchive& ar);    // read item from archive
  716.     virtual void WriteItem(CArchive& ar);   // write item to archive
  717.     virtual void CommitItem(BOOL bSuccess); // commit item's storage
  718.  
  719.     // compound & flat file implementations of above
  720.     void GetItemStorageFlat();
  721.     void ReadItemFlat(CArchive& ar);
  722.     void WriteItemFlat(CArchive& ar);
  723.     void GetItemStorageCompound();
  724.     void ReadItemCompound(CArchive& ar);
  725.     void WriteItemCompound(CArchive& ar);
  726.  
  727. // Interface Maps
  728. public:
  729.     BEGIN_INTERFACE_PART(OleClientSite, IOleClientSite)
  730.         INIT_INTERFACE_PART(COleClientItem, OleClientSite)
  731.         STDMETHOD(SaveObject)();
  732.         STDMETHOD(GetMoniker)(DWORD, DWORD, LPMONIKER*);
  733.         STDMETHOD(GetContainer)(LPOLECONTAINER*);
  734.         STDMETHOD(ShowObject)();
  735.         STDMETHOD(OnShowWindow)(BOOL);
  736.         STDMETHOD(RequestNewObjectLayout)();
  737.     END_INTERFACE_PART(OleClientSite)
  738.  
  739.     BEGIN_INTERFACE_PART(AdviseSink, IAdviseSink)
  740.         INIT_INTERFACE_PART(COleClientItem, AdviseSink)
  741.         STDMETHOD_(void,OnDataChange)(LPFORMATETC, LPSTGMEDIUM);
  742.         STDMETHOD_(void,OnViewChange)(DWORD, LONG);
  743.         STDMETHOD_(void,OnRename)(LPMONIKER);
  744.         STDMETHOD_(void,OnSave)();
  745.         STDMETHOD_(void,OnClose)();
  746.     END_INTERFACE_PART(AdviseSink)
  747.  
  748.     BEGIN_INTERFACE_PART(OleIPSite, IOleInPlaceSite)
  749.         INIT_INTERFACE_PART(COleClientItem, OleIPSite)
  750.         STDMETHOD(GetWindow)(HWND*);
  751.         STDMETHOD(ContextSensitiveHelp)(BOOL);
  752.         STDMETHOD(CanInPlaceActivate)();
  753.         STDMETHOD(OnInPlaceActivate)();
  754.         STDMETHOD(OnUIActivate)();
  755.         STDMETHOD(GetWindowContext)(LPOLEINPLACEFRAME*,
  756.             LPOLEINPLACEUIWINDOW*, LPRECT, LPRECT, LPOLEINPLACEFRAMEINFO);
  757.         STDMETHOD(Scroll)(SIZE);
  758.         STDMETHOD(OnUIDeactivate)(BOOL);
  759.         STDMETHOD(OnInPlaceDeactivate)();
  760.         STDMETHOD(DiscardUndoState)();
  761.         STDMETHOD(DeactivateAndUndo)();
  762.         STDMETHOD(OnPosRectChange)(LPCRECT);
  763.     END_INTERFACE_PART(OleIPSite)
  764.  
  765.     DECLARE_INTERFACE_MAP()
  766.  
  767. // Friendship declarations (to avoid many public members)
  768.     friend class COleUIWindow;
  769.     friend class COleFrameWindow;
  770.     friend class COleLinkingDoc;
  771. };
  772.  
  773. class COleDocObjectItem : public COleClientItem
  774. {
  775.     friend class COleFrameHook;
  776.     DECLARE_DYNAMIC(COleDocObjectItem)
  777.  
  778. // Constructors
  779. public:
  780.     COleDocObjectItem(COleDocument* pContainerDoc = NULL);
  781.  
  782. //Overridables
  783. public:
  784.     LPOLEDOCUMENTVIEW GetActiveView() const;
  785.     virtual void Release(OLECLOSE dwCloseOption = OLECLOSE_NOSAVE);
  786.     virtual void OnInsertMenus(CMenu* pMenuShared,
  787.         LPOLEMENUGROUPWIDTHS lpMenuWidths);
  788.     virtual void OnRemoveMenus(CMenu *pMenuShared);
  789.  
  790. // Operations
  791. public:
  792.     static BOOL OnPreparePrinting(CView* pCaller, CPrintInfo* pInfo,
  793.         BOOL bPrintAll = TRUE);
  794.     static void OnPrint(CView* pCaller, CPrintInfo* pInfo,
  795.         BOOL bPrintAll = TRUE);
  796.     BOOL GetPageCount(LPLONG pnFirstPage, LPLONG pcPages);
  797.     HRESULT ExecCommand(DWORD nCmdID,
  798.         DWORD nCmdExecOpt = OLECMDEXECOPT_DONTPROMPTUSER,
  799.         const GUID* pguidCmdGroup = NULL);
  800.  
  801. // Implementation
  802. public:
  803.     virtual ~COleDocObjectItem();
  804.     CMenu* m_pHelpPopupMenu;
  805. protected:
  806.     virtual CMenu* GetHelpMenu(UINT& nPosition);
  807.     void ActivateAndShow();
  808.     LPOLEDOCUMENTVIEW m_pActiveView;
  809.     LPPRINT m_pIPrint;
  810.     BOOL SupportsIPrint();
  811.     BOOL m_bInHelpMenu;
  812.  
  813.     BEGIN_INTERFACE_PART(OleDocumentSite, IOleDocumentSite)
  814.         INIT_INTERFACE_PART(COleDocObjectItem, OleDocumentSite)
  815.         STDMETHOD(ActivateMe)(LPOLEDOCUMENTVIEW pViewToActivate);
  816.     END_INTERFACE_PART(OleDocumentSite)
  817.  
  818.     DECLARE_INTERFACE_MAP()
  819. };
  820.  
  821. /////////////////////////////////////////////////////////////////////////////
  822. // COleServerItem - IOleObject & IDataObject OLE component
  823.  
  824. #ifdef _AFXDLL
  825. class COleServerItem : public CDocItem
  826. #else
  827. class AFX_NOVTABLE COleServerItem : public CDocItem
  828. #endif
  829. {
  830.     DECLARE_DYNAMIC(COleServerItem)
  831. protected:
  832.     // NOTE: many members in this class are protected - since everything
  833.     //   in this class is designed for implementing an OLE server.
  834.     // Requests will come from OLE containers through non-C++ mechanisms,
  835.     //   which will result in virtual functions in this class being called.
  836.  
  837. // Constructors
  838.     COleServerItem(COleServerDoc* pServerDoc, BOOL bAutoDelete);
  839.         // If your COleServerItem is an integral part of your data,
  840.         //  bAutoDelete should be FALSE.  If your COleServerItem can be
  841.         //  deleted when a link is released, it can be TRUE.
  842.  
  843.     COleDataSource* GetDataSource();
  844.         // Use this data source to add conversion formats that your
  845.         //  server should support.  Usually such formats are
  846.         //  added in the item's constructor.
  847.  
  848. // Public Attributes
  849. public:
  850.     COleServerDoc* GetDocument() const; // return server document
  851.  
  852.     // naming (for links only)
  853.     const CString& GetItemName() const; // get name of linked item
  854.     void SetItemName(LPCTSTR lpszItemName);  // set name of linked item
  855.  
  856.     // link state
  857.     BOOL IsConnected() const;   // returns TRUE if item has a client
  858.     BOOL IsLinkedItem() const;  // returns TRUE if item is not embedded item
  859.  
  860.     // extents
  861.     CSize m_sizeExtent;
  862.         // HIMETRIC size -- the default implementation of OnSetExtent
  863.         //  updates this member variable.  This member tells the server how
  864.         //  much of the object is visible in the container document.
  865.  
  866. // Operations
  867. public:
  868.     void NotifyChanged(DVASPECT nDrawAspect = DVASPECT_CONTENT);
  869.         // call this after you change item
  870.     void CopyToClipboard(BOOL bIncludeLink = FALSE);
  871.         // helper for implementing server 'copy to clipboard'
  872.     DROPEFFECT DoDragDrop(LPCRECT lpRectItem, CPoint ptOffset,
  873.         BOOL bIncludeLink = FALSE,
  874.         DWORD dwEffects = DROPEFFECT_COPY|DROPEFFECT_MOVE,
  875.         LPCRECT lpRectStartDrag = NULL);
  876.     void GetClipboardData(COleDataSource* pDataSource,
  877.         BOOL bIncludeLink = FALSE, LPPOINT lpOffset = NULL,
  878.         LPSIZE lpSize = NULL);
  879.  
  880. // Overridables
  881.     // overridables you must implement for yourself
  882.     virtual BOOL OnDraw(CDC* pDC, CSize& rSize) = 0;
  883.         // drawing for metafile format (return FALSE if not supported or error)
  884.         //  (called for DVASPECT_CONTENT only)
  885.  
  886.     // overridables you may want to implement yourself
  887.     virtual void OnUpdate(COleServerItem* pSender,
  888.         LPARAM lHint, CObject* pHint, DVASPECT nDrawAspect);
  889.         // the default implementation always calls NotifyChanged
  890.  
  891.     virtual BOOL OnDrawEx(CDC* pDC, DVASPECT nDrawAspect, CSize& rSize);
  892.         // advanced drawing -- called for DVASPECT other than DVASPECT_CONTENT
  893.     virtual BOOL OnSetExtent(DVASPECT nDrawAspect, const CSize& size);
  894.     virtual BOOL OnGetExtent(DVASPECT nDrawAspect, CSize& rSize);
  895.         // default implementation uses m_sizeExtent
  896.  
  897.     // overridables you do not have to implement
  898.     virtual void OnDoVerb(LONG iVerb);
  899.         // default routes to OnShow &/or OnOpen
  900.     virtual BOOL OnSetColorScheme(const LOGPALETTE* lpLogPalette);
  901.         // default does nothing
  902.     virtual COleDataSource* OnGetClipboardData(BOOL bIncludeLink,
  903.         LPPOINT lpOffset, LPSIZE lpSize);
  904.         // called for access to clipboard data
  905.     virtual BOOL OnQueryUpdateItems();
  906.         // called to determine if there are any contained out-of-date links
  907.     virtual void OnUpdateItems();
  908.         // called to update any out-of-date links
  909.  
  910. protected:
  911.     virtual void OnShow();
  912.         // show item in the user interface (may edit in-place)
  913.     virtual void OnOpen();
  914.         // show item in the user interface (must open fully)
  915.     virtual void OnHide();
  916.         // hide document (and sometimes application)
  917.  
  918.     // very advanced overridables
  919. public:
  920.     virtual BOOL OnInitFromData(COleDataObject* pDataObject, BOOL bCreation);
  921.         // initialize object from IDataObject
  922.  
  923.     // see COleDataSource for a description of these overridables
  924.     virtual BOOL OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* phGlobal);
  925.     virtual BOOL OnRenderFileData(LPFORMATETC lpFormatEtc, CFile* pFile);
  926.     virtual BOOL OnRenderData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium);
  927.         // HGLOBAL version will be called first, then CFile* version
  928.  
  929.     virtual BOOL OnSetData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium,
  930.         BOOL bRelease);
  931.         // Rare -- only if you support SetData (programmatic paste)
  932.  
  933.     // advanced helpers for CopyToClipboard
  934.     void GetEmbedSourceData(LPSTGMEDIUM lpStgMedium);
  935.     void AddOtherClipboardData(COleDataSource* pDataSource);
  936.     BOOL GetLinkSourceData(LPSTGMEDIUM lpStgMedium);
  937.     void GetObjectDescriptorData(LPPOINT lpOffset, LPSIZE lpSize,
  938.         LPSTGMEDIUM lpStgMedium);
  939.  
  940. // Implementation
  941. public:
  942.     BOOL m_bNeedUnlock;             // if TRUE need to pDoc->LockExternal(FALSE)
  943.     BOOL m_bAutoDelete;             // if TRUE will OnRelease will 'delete this'
  944.  
  945.     // special version of OnFinalRelease to implement document locking
  946.     virtual void OnFinalRelease();
  947.  
  948. protected:
  949.     CString m_strItemName;          // simple item name
  950.  
  951. public:
  952.     LPOLEADVISEHOLDER m_lpOleAdviseHolder;  // may be NULL
  953.     LPDATAADVISEHOLDER m_lpDataAdviseHolder;    // may be NULL
  954.  
  955.     virtual ~COleServerItem();
  956. #ifdef _DEBUG
  957.     virtual void AssertValid() const;
  958.     virtual void Dump(CDumpContext& dc) const;
  959. #endif
  960.  
  961.     // implementation helpers
  962.     void NotifyClient(OLE_NOTIFICATION wNotification, DWORD dwParam);
  963.     LPDATAOBJECT GetDataObject();
  964.     LPOLEOBJECT GetOleObject();
  965.     LPMONIKER GetMoniker(OLEGETMONIKER nAssign);
  966.  
  967. protected:
  968.     virtual BOOL GetMetafileData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM pmedium);
  969.         // calls OnDraw or OnDrawEx
  970.     virtual void OnSaveEmbedding(LPSTORAGE lpStorage);
  971.     virtual BOOL IsBlank() const;
  972.  
  973.     // CItemDataSource implements OnRender reflections to COleServerItem
  974.     class CItemDataSource : public COleDataSource
  975.     {
  976.     protected:
  977.         // the GetData and SetData interfaces forward to m_pItem
  978.         virtual BOOL OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* phGlobal);
  979.         virtual BOOL OnRenderFileData(LPFORMATETC lpFormatEtc, CFile* pFile);
  980.         virtual BOOL OnRenderData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium);
  981.             // HGLOBAL version will be called first, then CFile* version
  982.  
  983.         virtual BOOL OnSetData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium,
  984.             BOOL bRelease);
  985.     };
  986.     CItemDataSource m_dataSource;
  987.         // data source used to implement IDataObject
  988.  
  989. // Interface Maps
  990. //  (Note: these interface maps are used just for link implementation)
  991. public:
  992.     BEGIN_INTERFACE_PART(OleObject, IOleObject)
  993.         INIT_INTERFACE_PART(COleServerItem, OleObject)
  994.         STDMETHOD(SetClientSite)(LPOLECLIENTSITE);
  995.         STDMETHOD(GetClientSite)(LPOLECLIENTSITE*);
  996.         STDMETHOD(SetHostNames)(LPCOLESTR, LPCOLESTR);
  997.         STDMETHOD(Close)(DWORD);
  998.         STDMETHOD(SetMoniker)(DWORD, LPMONIKER);
  999.         STDMETHOD(GetMoniker)(DWORD, DWORD, LPMONIKER*);
  1000.         STDMETHOD(InitFromData)(LPDATAOBJECT, BOOL, DWORD);
  1001.         STDMETHOD(GetClipboardData)(DWORD, LPDATAOBJECT*);
  1002.         STDMETHOD(DoVerb)(LONG, LPMSG, LPOLECLIENTSITE, LONG, HWND, LPCRECT);
  1003.         STDMETHOD(EnumVerbs)(LPENUMOLEVERB*);
  1004.         STDMETHOD(Update)();
  1005.         STDMETHOD(IsUpToDate)();
  1006.         STDMETHOD(GetUserClassID)(LPCLSID);
  1007.         STDMETHOD(GetUserType)(DWORD, LPOLESTR*);
  1008.         STDMETHOD(SetExtent)(DWORD, LPSIZEL);
  1009.         STDMETHOD(GetExtent)(DWORD, LPSIZEL);
  1010.         STDMETHOD(Advise)(LPADVISESINK, LPDWORD);
  1011.         STDMETHOD(Unadvise)(DWORD);
  1012.         STDMETHOD(EnumAdvise)(LPENUMSTATDATA*);
  1013.         STDMETHOD(GetMiscStatus)(DWORD, LPDWORD);
  1014.         STDMETHOD(SetColorScheme)(LPLOGPALETTE);
  1015.     END_INTERFACE_PART(OleObject)
  1016.  
  1017.     BEGIN_INTERFACE_PART(DataObject, IDataObject)
  1018.         INIT_INTERFACE_PART(COleServerItem, DataObject)
  1019.         STDMETHOD(GetData)(LPFORMATETC, LPSTGMEDIUM);
  1020.         STDMETHOD(GetDataHere)(LPFORMATETC, LPSTGMEDIUM);
  1021.         STDMETHOD(QueryGetData)(LPFORMATETC);
  1022.         STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC, LPFORMATETC);
  1023.         STDMETHOD(SetData)(LPFORMATETC, LPSTGMEDIUM, BOOL);
  1024.         STDMETHOD(EnumFormatEtc)(DWORD, LPENUMFORMATETC*);
  1025.         STDMETHOD(DAdvise)(LPFORMATETC, DWORD, LPADVISESINK, LPDWORD);
  1026.         STDMETHOD(DUnadvise)(DWORD);
  1027.         STDMETHOD(EnumDAdvise)(LPENUMSTATDATA*);
  1028.     END_INTERFACE_PART(DataObject)
  1029.  
  1030.     DECLARE_INTERFACE_MAP()
  1031.  
  1032.     friend class CItemDataSource;
  1033.     friend class COleServerDoc;
  1034.     friend class COleLinkingDoc;
  1035. };
  1036.  
  1037. /////////////////////////////////////////////////////////////////////////////
  1038. // COleLinkingDoc -
  1039. //  (enables linking to embeddings - beginnings of server fuctionality)
  1040.  
  1041. class COleLinkingDoc : public COleDocument
  1042. {
  1043.     DECLARE_DYNAMIC(COleLinkingDoc)
  1044.  
  1045. // Constructors
  1046. public:
  1047.     COleLinkingDoc();
  1048.  
  1049. // Operations
  1050.     BOOL Register(COleObjectFactory* pFactory, LPCTSTR lpszPathName);
  1051.         // notify the running object table and connect to pServer
  1052.     void Revoke();
  1053.         // revoke from running object table
  1054.  
  1055. // Overridables
  1056. protected:
  1057.     virtual COleServerItem* OnGetLinkedItem(LPCTSTR lpszItemName);
  1058.         // return item for the named linked item (for supporting links)
  1059.     virtual COleClientItem* OnFindEmbeddedItem(LPCTSTR lpszItemName);
  1060.         // return item for the named embedded item (for links to embeddings)
  1061.  
  1062. // Implementation
  1063. public:
  1064.     COleObjectFactory* m_pFactory;  // back-pointer to server
  1065.  
  1066. #ifdef _DEBUG
  1067.     virtual void AssertValid() const;
  1068.     virtual void Dump(CDumpContext& dc) const;
  1069. #endif
  1070.     virtual ~COleLinkingDoc();
  1071.  
  1072.     // overrides for updating of monikers & running object table registration
  1073.     virtual BOOL OnNewDocument();
  1074.     virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
  1075.     virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
  1076.     virtual void OnCloseDocument();
  1077.     virtual LPOLEITEMCONTAINER GetContainer();
  1078.     virtual LPMONIKER GetMoniker(OLEGETMONIKER nAssign);
  1079.  
  1080.     // special handling of error messages during save/load
  1081.     virtual void ReportSaveLoadException(LPCTSTR lpszPathName,
  1082.         CException* e, BOOL bSaving, UINT nIDPDefault);
  1083.     void BeginDeferErrors();
  1084.     SCODE EndDeferErrors(SCODE sc);
  1085.  
  1086. protected:
  1087.     BOOL m_bDeferErrors;    // TRUE if in non-interactive OLE mode
  1088.     CException* m_pLastException;
  1089.  
  1090.     DWORD m_dwRegister;     // file moniker's registration in the ROT
  1091.     LPMONIKER m_lpMonikerROT; // file moniker that is registered
  1092.     CString m_strMoniker;   // filename used to create moniker
  1093.     BOOL m_bVisibleLock;    // TRUE if user is holding lock on document
  1094.  
  1095.     // implementation helpers
  1096.     virtual BOOL RegisterIfServerAttached(LPCTSTR lpszPathName, BOOL bMessage);
  1097.     void LockExternal(BOOL bLock, BOOL bRemoveRefs);
  1098.     void UpdateVisibleLock(BOOL bVisible, BOOL bRemoveRefs);
  1099.     virtual void OnShowViews(BOOL bVisible);
  1100.  
  1101.     virtual void SaveToStorage(CObject* pObject = NULL);
  1102.  
  1103. // Interface Maps
  1104. public:
  1105.     BEGIN_INTERFACE_PART(PersistFile, IPersistFile)
  1106.         INIT_INTERFACE_PART(COleLinkingDoc, PersistFile)
  1107.         STDMETHOD(GetClassID)(LPCLSID);
  1108.         STDMETHOD(IsDirty)();
  1109.         STDMETHOD(Load)(LPCOLESTR, DWORD);
  1110.         STDMETHOD(Save)(LPCOLESTR, BOOL);
  1111.         STDMETHOD(SaveCompleted)(LPCOLESTR);
  1112.         STDMETHOD(GetCurFile)(LPOLESTR*);
  1113.     END_INTERFACE_PART(PersistFile)
  1114.  
  1115.     BEGIN_INTERFACE_PART(OleItemContainer, IOleItemContainer)
  1116.         INIT_INTERFACE_PART(COleLinkingDoc, OleItemContainer)
  1117.         STDMETHOD(ParseDisplayName)(LPBC, LPOLESTR, ULONG*, LPMONIKER*);
  1118.         STDMETHOD(EnumObjects)(DWORD, LPENUMUNKNOWN*);
  1119.         STDMETHOD(LockContainer)(BOOL);
  1120.         STDMETHOD(GetObject)(LPOLESTR, DWORD, LPBINDCTX, REFIID, LPVOID*);
  1121.         STDMETHOD(GetObjectStorage)(LPOLESTR, LPBINDCTX, REFIID, LPVOID*);
  1122.         STDMETHOD(IsRunning)(LPOLESTR);
  1123.     END_INTERFACE_PART(OleItemContainer)
  1124.  
  1125.     DECLARE_INTERFACE_MAP()
  1126.  
  1127.     friend class COleClientItem;
  1128.     friend class COleClientItem::XOleClientSite;
  1129.     friend class COleServerItem::XOleObject;
  1130. };
  1131.  
  1132. //////////////////////////////////////////////////////////////////////////////
  1133. // COleServerDoc - registered server document containing COleServerItems
  1134.  
  1135. #ifdef _AFXDLL
  1136. class COleServerDoc : public COleLinkingDoc
  1137. #else
  1138. class AFX_NOVTABLE COleServerDoc : public COleLinkingDoc
  1139. #endif
  1140. {
  1141.     DECLARE_DYNAMIC(COleServerDoc)
  1142.  
  1143. // Constructors and Destructors
  1144. public:
  1145.     COleServerDoc();
  1146.  
  1147. // Attributes
  1148.     BOOL IsEmbedded() const;    // TRUE if document is an embedding
  1149.     BOOL IsDocObject() const;   // TRUE if document is a DocObject
  1150.     COleServerItem* GetEmbeddedItem();
  1151.         // return embedded item for document (will allocate if necessary)
  1152.  
  1153.     // attributes specific to in-place activation
  1154.     BOOL IsInPlaceActive() const;
  1155.     void GetItemPosition(LPRECT lpPosRect) const;
  1156.         // get current position rectangle of in-place edit
  1157.     void GetItemClipRect(LPRECT lpClipRect) const;
  1158.         // get current clipping rectangle of in-place edit
  1159.     BOOL GetZoomFactor(LPSIZE lpSizeNum = NULL, LPSIZE lpSizeDenom = NULL,
  1160.         LPCRECT lpPosRect = NULL) const;
  1161.         // returns the zoom factor in pixels
  1162.  
  1163. // Operations
  1164.     void NotifyChanged();
  1165.         // call this after you change some global attribute like
  1166.         //  document dimensions
  1167.     void UpdateAllItems(COleServerItem* pSender,
  1168.         LPARAM lHint = 0L, CObject* pHint = NULL,
  1169.         DVASPECT nDrawAspect = DVASPECT_CONTENT);
  1170.  
  1171.     // changes to the entire document (automatically notifies clients)
  1172.     void NotifyRename(LPCTSTR lpszNewName);
  1173.     void NotifySaved();
  1174.     void NotifyClosed();        // call this after you close document
  1175.  
  1176.     // specific operations for embedded documents
  1177.     void SaveEmbedding();       // call this to save embedded (before closing)
  1178.  
  1179.     // specific to in-place activation
  1180.     BOOL ActivateInPlace();
  1181.     void ActivateDocObject();
  1182.     void RequestPositionChange(LPCRECT lpPosRect);
  1183.     BOOL ScrollContainerBy(CSize sizeScroll);
  1184.     BOOL DeactivateAndUndo();
  1185.     BOOL DiscardUndoState();
  1186.  
  1187. public:
  1188. // Overridables for standard user interface (full server)
  1189.     virtual BOOL OnUpdateDocument(); // implementation of embedded update
  1190.  
  1191. protected:
  1192. // Overridables you must implement for yourself
  1193.     virtual COleServerItem* OnGetEmbeddedItem() = 0;
  1194.         // return item representing entire (embedded) document
  1195.  
  1196. // Overridables you do not have to implement
  1197.     virtual void OnClose(OLECLOSE dwCloseOption);
  1198.     virtual void OnSetHostNames(LPCTSTR lpszHost, LPCTSTR lpszHostObj);
  1199.     virtual HRESULT OnExecOleCmd(const GUID* pguidCmdGroup, DWORD nCmdID,
  1200.         DWORD nCmdExecOpt, VARIANTARG* pvarargIn, VARIANTARG* pvarargOut);
  1201.     virtual CDocObjectServer* GetDocObjectServer(LPOLEDOCUMENTSITE pDocSite);
  1202.  
  1203. // Advanced overridables
  1204.     LPUNKNOWN GetInterfaceHook(const void* piid);
  1205.     virtual void OnShowDocument(BOOL bShow);
  1206.         // show first frame for document or hide all frames for document
  1207.  
  1208. // Advanced overridables for in-place activation
  1209. public:
  1210.     virtual void OnDeactivate();
  1211.     virtual void OnDeactivateUI(BOOL bUndoable);
  1212.  
  1213. protected:
  1214.     virtual void OnSetItemRects(LPCRECT lpPosRect, LPCRECT lpClipRect);
  1215.     virtual BOOL OnReactivateAndUndo();
  1216.  
  1217.     virtual void OnFrameWindowActivate(BOOL bActivate);
  1218.     virtual void OnDocWindowActivate(BOOL bActivate);
  1219.     virtual void OnShowControlBars(CFrameWnd* pFrameWnd, BOOL bShow);
  1220.     virtual COleIPFrameWnd* CreateInPlaceFrame(CWnd* pParentWnd);
  1221.     virtual void DestroyInPlaceFrame(COleIPFrameWnd* pFrameWnd);
  1222. public:
  1223.     virtual void OnResizeBorder(LPCRECT lpRectBorder,
  1224.         LPOLEINPLACEUIWINDOW lpUIWindow, BOOL bFrame);
  1225.  
  1226. // Implementation
  1227. protected:
  1228.     LPOLECLIENTSITE m_lpClientSite;     // for embedded item
  1229.     CString m_strHostObj;               // name of document in container
  1230.     BOOL m_bCntrVisible;                // TRUE if OnShowWindow(TRUE) called
  1231.     BOOL m_bClosing;                    // TRUE if shutting down
  1232.     COleServerItem* m_pEmbeddedItem;    // pointer to embedded item for document
  1233.  
  1234.     COleIPFrameWnd* m_pInPlaceFrame;    // not NULL if in-place activated
  1235.     CWnd* m_pOrigParent;                // not NULL if existing view used
  1236.     DWORD m_dwOrigStyle;                // original style of in-place view
  1237.     DWORD m_dwOrigStyleEx;              // original extended style
  1238.  
  1239.     CDocObjectServer* m_pDocObjectServer;  // if DocObject, ptr to doc site
  1240.  
  1241. public:
  1242.     virtual ~COleServerDoc();
  1243. #ifdef _DEBUG
  1244.     virtual void AssertValid() const;
  1245.     virtual void Dump(CDumpContext& dc) const;
  1246. #endif
  1247.  
  1248.     // overridables for implementation
  1249.     virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
  1250.     virtual void OnCloseDocument();
  1251.     virtual void DeleteContents(); // delete auto-delete server items
  1252.     virtual LPMONIKER GetMoniker(OLEGETMONIKER nAssign);
  1253.     virtual COleServerItem* OnGetLinkedItem(LPCTSTR lpszItemName);
  1254.         // return item for the named linked item (only if supporting links)
  1255.     virtual BOOL CanCloseFrame(CFrameWnd* pFrame);
  1256.  
  1257. protected:
  1258.     // overrides to handle server user-interface
  1259.     virtual BOOL SaveModified();        // return TRUE if ok to continue
  1260.     virtual HMENU GetDefaultMenu();     // return menu based on doc type
  1261.     virtual HACCEL GetDefaultAccelerator(); // return accel table based on doc type
  1262.     virtual BOOL GetFileTypeString(CString& rString);
  1263.  
  1264.     // IPersistStorage implementation
  1265.     virtual void OnNewEmbedding(LPSTORAGE lpStorage);
  1266.     virtual void OnOpenEmbedding(LPSTORAGE lpStorage);
  1267.     virtual void OnSaveEmbedding(LPSTORAGE lpStorage);
  1268.  
  1269.     // Implementation helpers
  1270.     void NotifyAllItems(OLE_NOTIFICATION wNotification, DWORD dwParam);
  1271.     BOOL SaveModifiedPrompt();
  1272.     void ConnectView(CWnd* pParentWnd, CView* pView);
  1273.     void UpdateUsingHostObj(UINT nIDS, CCmdUI* pCmdUI);
  1274.  
  1275. // Message Maps
  1276.     //{{AFX_MSG(COleServerDoc)
  1277.     afx_msg void OnFileUpdate();
  1278.     afx_msg void OnFileSaveCopyAs();
  1279.     afx_msg void OnUpdateFileUpdate(CCmdUI* pCmdUI);
  1280.     afx_msg void OnUpdateFileExit(CCmdUI* pCmdUI);
  1281.     //}}AFX_MSG
  1282.     DECLARE_MESSAGE_MAP()
  1283.  
  1284. // Interface Maps
  1285. public:
  1286.     BEGIN_INTERFACE_PART(PersistStorage, IPersistStorage)
  1287.         INIT_INTERFACE_PART(COleServerDoc, PersistStorage)
  1288.         STDMETHOD(GetClassID)(LPCLSID);
  1289.         STDMETHOD(IsDirty)();
  1290.         STDMETHOD(InitNew)(LPSTORAGE);
  1291.         STDMETHOD(Load)(LPSTORAGE);
  1292.         STDMETHOD(Save)(LPSTORAGE, BOOL);
  1293.         STDMETHOD(SaveCompleted)(LPSTORAGE);
  1294.         STDMETHOD(HandsOffStorage)();
  1295.     END_INTERFACE_PART(PersistStorage)
  1296.  
  1297.     BEGIN_INTERFACE_PART(OleObject, IOleObject)
  1298.         INIT_INTERFACE_PART(COleServerDoc, OleObject)
  1299.         STDMETHOD(SetClientSite)(LPOLECLIENTSITE);
  1300.         STDMETHOD(GetClientSite)(LPOLECLIENTSITE*);
  1301.         STDMETHOD(SetHostNames)(LPCOLESTR, LPCOLESTR);
  1302.         STDMETHOD(Close)(DWORD);
  1303.         STDMETHOD(SetMoniker)(DWORD, LPMONIKER);
  1304.         STDMETHOD(GetMoniker)(DWORD, DWORD, LPMONIKER*);
  1305.         STDMETHOD(InitFromData)(LPDATAOBJECT, BOOL, DWORD);
  1306.         STDMETHOD(GetClipboardData)(DWORD, LPDATAOBJECT*);
  1307.         STDMETHOD(DoVerb)(LONG, LPMSG, LPOLECLIENTSITE, LONG, HWND, LPCRECT);
  1308.         STDMETHOD(EnumVerbs)(IEnumOLEVERB**);
  1309.         STDMETHOD(Update)();
  1310.         STDMETHOD(IsUpToDate)();
  1311.         STDMETHOD(GetUserClassID)(CLSID*);
  1312.         STDMETHOD(GetUserType)(DWORD, LPOLESTR*);
  1313.         STDMETHOD(SetExtent)(DWORD, LPSIZEL);
  1314.         STDMETHOD(GetExtent)(DWORD, LPSIZEL);
  1315.         STDMETHOD(Advise)(LPADVISESINK, LPDWORD);
  1316.         STDMETHOD(Unadvise)(DWORD);
  1317.         STDMETHOD(EnumAdvise)(LPENUMSTATDATA*);
  1318.         STDMETHOD(GetMiscStatus)(DWORD, LPDWORD);
  1319.         STDMETHOD(SetColorScheme)(LPLOGPALETTE);
  1320.     END_INTERFACE_PART(OleObject)
  1321.  
  1322.     BEGIN_INTERFACE_PART(DataObject, IDataObject)
  1323.         INIT_INTERFACE_PART(COleServerDoc, DataObject)
  1324.         STDMETHOD(GetData)(LPFORMATETC, LPSTGMEDIUM);
  1325.         STDMETHOD(GetDataHere)(LPFORMATETC, LPSTGMEDIUM);
  1326.         STDMETHOD(QueryGetData)(LPFORMATETC);
  1327.         STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC, LPFORMATETC);
  1328.         STDMETHOD(SetData)(LPFORMATETC, LPSTGMEDIUM, BOOL);
  1329.         STDMETHOD(EnumFormatEtc)(DWORD, LPENUMFORMATETC*);
  1330.         STDMETHOD(DAdvise)(LPFORMATETC, DWORD, LPADVISESINK, LPDWORD);
  1331.         STDMETHOD(DUnadvise)(DWORD);
  1332.         STDMETHOD(EnumDAdvise)(LPENUMSTATDATA*);
  1333.     END_INTERFACE_PART(DataObject)
  1334.  
  1335.     BEGIN_INTERFACE_PART(OleInPlaceObject, IOleInPlaceObject)
  1336.         INIT_INTERFACE_PART(COleServerDoc, OleInPlaceObject)
  1337.         STDMETHOD(GetWindow)(HWND*);
  1338.         STDMETHOD(ContextSensitiveHelp)(BOOL);
  1339.         STDMETHOD(InPlaceDeactivate)();
  1340.         STDMETHOD(UIDeactivate)();
  1341.         STDMETHOD(SetObjectRects)(LPCRECT, LPCRECT);
  1342.         STDMETHOD(ReactivateAndUndo)();
  1343.     END_INTERFACE_PART(OleInPlaceObject)
  1344.  
  1345.     BEGIN_INTERFACE_PART(OleInPlaceActiveObject, IOleInPlaceActiveObject)
  1346.         INIT_INTERFACE_PART(COleServerDoc, OleInPlaceActiveObject)
  1347.         STDMETHOD(GetWindow)(HWND*);
  1348.         STDMETHOD(ContextSensitiveHelp)(BOOL);
  1349.         STDMETHOD(TranslateAccelerator)(LPMSG);
  1350.         STDMETHOD(OnFrameWindowActivate)(BOOL);
  1351.         STDMETHOD(OnDocWindowActivate)(BOOL);
  1352.         STDMETHOD(ResizeBorder)(LPCRECT, LPOLEINPLACEUIWINDOW, BOOL);
  1353.         STDMETHOD(EnableModeless)(BOOL);
  1354.     END_INTERFACE_PART(OleInPlaceActiveObject)
  1355.  
  1356.     DECLARE_INTERFACE_MAP()
  1357.  
  1358.     friend class COleServer;
  1359.     friend class COleServerItem;
  1360.     friend class CDocObjectServer;
  1361. };
  1362.  
  1363. //////////////////////////////////////////////////////////////////////////////
  1364. // COleIPFrameWnd
  1365.  
  1366. class COleCntrFrameWnd;
  1367.  
  1368. class COleIPFrameWnd : public CFrameWnd
  1369. {
  1370.     DECLARE_DYNCREATE(COleIPFrameWnd)
  1371.  
  1372. // Constructors
  1373. public:
  1374.     COleIPFrameWnd();
  1375.  
  1376. // Overridables
  1377. public:
  1378.     virtual BOOL OnCreateControlBars(CWnd* pWndFrame, CWnd* pWndDoc);
  1379.         // create control bars on container windows (pWndDoc can be NULL)
  1380.     virtual BOOL OnCreateControlBars(CFrameWnd* pWndFrame, CFrameWnd* pWndDoc);
  1381.         // create control bars on container windows (pWndDoc can be NULL)
  1382.  
  1383.     virtual void RepositionFrame(LPCRECT lpPosRect, LPCRECT lpClipRect);
  1384.         // Advanced: reposition frame to wrap around new lpPosRect
  1385.  
  1386. // Implementation
  1387. public:
  1388.     BOOL m_bUIActive;   // TRUE if currently in uiacitve state
  1389.  
  1390.     virtual BOOL LoadFrame(UINT nIDResource,
  1391.         DWORD dwDefaultStyle = WS_CHILD|WS_BORDER|WS_CLIPSIBLINGS,
  1392.         CWnd* pParentWnd = NULL,
  1393.         CCreateContext* pContext = NULL);
  1394.     virtual void RecalcLayout(BOOL bNotify = TRUE);
  1395.     virtual BOOL PreTranslateMessage(MSG* pMsg);
  1396.     virtual LRESULT OnSetMessageString(WPARAM wParam, LPARAM lParam);
  1397.     virtual ~COleIPFrameWnd();
  1398. #ifdef _DEBUG
  1399.     virtual void AssertValid() const;
  1400.     virtual void Dump(CDumpContext& dc) const;
  1401. #endif
  1402.  
  1403. protected:
  1404.     // in-place state
  1405.     OLEINPLACEFRAMEINFO m_frameInfo;
  1406.     LPOLEINPLACEFRAME m_lpFrame;
  1407.     LPOLEINPLACEUIWINDOW m_lpDocFrame;
  1408.     COleCntrFrameWnd* m_pMainFrame;
  1409.     COleCntrFrameWnd* m_pDocFrame;
  1410.  
  1411.     HMENU m_hSharedMenu;
  1412.     OLEMENUGROUPWIDTHS m_menuWidths;
  1413.     HOLEMENU m_hOleMenu;
  1414.     CRect m_rectPos;            // client area rect of the item
  1415.     CRect m_rectClip;           // area to which frame should be clipped
  1416.     BOOL m_bInsideRecalc;
  1417.  
  1418.     HMENU _m_Reserved;
  1419.  
  1420.     // Advanced: in-place activation virtual implementation
  1421.     virtual BOOL BuildSharedMenu();
  1422.     virtual void DestroySharedMenu();
  1423.     virtual HMENU GetInPlaceMenu();
  1424.  
  1425.     // Advanced: possible override to change in-place sizing behavior
  1426.     virtual void OnRequestPositionChange(LPCRECT lpRect);
  1427.  
  1428. protected:
  1429.     //{{AFX_MSG(COleIPFrameWnd)
  1430.     afx_msg void OnSize(UINT nType, int cx, int cy);
  1431.     afx_msg LRESULT OnRecalcParent(WPARAM wParam, LPARAM lParam);
  1432.     afx_msg void OnIdleUpdateCmdUI();
  1433.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  1434.     afx_msg void OnDestroy();
  1435.     afx_msg LRESULT OnResizeChild(WPARAM wParam, LPARAM lParam);
  1436.     afx_msg void OnContextHelp();
  1437.     afx_msg void OnUpdateControlBarMenu(CCmdUI* pCmdUI);
  1438.     afx_msg BOOL OnBarCheck(UINT nID);
  1439.     afx_msg void OnWindowPosChanging(LPWINDOWPOS lpWndPos);
  1440.     //}}AFX_MSG
  1441.     DECLARE_MESSAGE_MAP()
  1442.  
  1443.     friend class COleServerDoc;
  1444.     friend class COleCntrFrameWnd;
  1445.     friend class CDocObjectServer;
  1446. };
  1447.  
  1448. /////////////////////////////////////////////////////////////////////////////
  1449. // COleResizeBar - supports in-place resizing in server applications
  1450.  
  1451. class COleResizeBar : public CControlBar
  1452. {
  1453.     DECLARE_DYNAMIC(COleResizeBar)
  1454.  
  1455. // Constructors
  1456. public:
  1457.     COleResizeBar();
  1458.     BOOL Create(CWnd* pParentWnd, DWORD dwStyle = WS_CHILD | WS_VISIBLE,
  1459.         UINT nID = AFX_IDW_RESIZE_BAR);
  1460.  
  1461. // Implementation
  1462. public:
  1463.     virtual ~COleResizeBar();
  1464.     virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
  1465.  
  1466. protected:
  1467.     CRectTracker m_tracker;     // implemented with a tracker
  1468.  
  1469. protected:
  1470.     //{{AFX_MSG(COleResizeBar)
  1471.     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  1472.     afx_msg void OnPaint();
  1473.     afx_msg void OnSize(UINT nType, int cx, int cy);
  1474.     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  1475.     afx_msg void OnLButtonDown(UINT, CPoint point);
  1476.     afx_msg LRESULT OnSizeParent(WPARAM wParam, LPARAM lParam);
  1477.     //}}AFX_MSG
  1478.     DECLARE_MESSAGE_MAP()
  1479. };
  1480. #endif // _WIN32_WCE
  1481.  
  1482. /////////////////////////////////////////////////////////////////////////////
  1483. // COleStreamFile - implementation of CFile which uses an IStream
  1484.  
  1485. class COleStreamFile : public CFile
  1486. {
  1487.     DECLARE_DYNAMIC(COleStreamFile)
  1488.  
  1489. // Constructors and Destructors
  1490. public:
  1491.     COleStreamFile(LPSTREAM lpStream = NULL);
  1492.  
  1493. // Operations
  1494.     // Note: OpenStream and CreateStream can accept eith STGM_ flags or
  1495.     //  CFile::OpenFlags bits since common values are guaranteed to have
  1496.     //  the same semantics.
  1497.     BOOL OpenStream(LPSTORAGE lpStorage, LPCTSTR lpszStreamName,
  1498.         DWORD nOpenFlags = modeReadWrite|shareExclusive,
  1499.         CFileException* pError = NULL);
  1500.     BOOL CreateStream(LPSTORAGE lpStorage, LPCTSTR lpszStreamName,
  1501.         DWORD nOpenFlags = modeReadWrite|shareExclusive|modeCreate,
  1502.         CFileException* pError = NULL);
  1503.  
  1504.     BOOL CreateMemoryStream(CFileException* pError = NULL);
  1505.  
  1506.     // attach & detach can be used when Open/Create functions aren't adequate
  1507.     void Attach(LPSTREAM lpStream);
  1508.     LPSTREAM Detach();
  1509.  
  1510.     IStream* GetStream() const;
  1511.     // Returns the current stream
  1512.  
  1513. // Implementation
  1514. public:
  1515.     LPSTREAM m_lpStream;
  1516. #ifdef _DEBUG
  1517.     virtual void AssertValid() const;
  1518.     virtual void Dump(CDumpContext& dc) const;
  1519. #endif
  1520.     virtual ~COleStreamFile();
  1521.  
  1522.     // attributes for implementation
  1523.     BOOL GetStatus(CFileStatus& rStatus) const;
  1524.     virtual DWORD GetPosition() const;
  1525.  
  1526.     virtual const CString GetStorageName() const;
  1527.  
  1528.     // overrides for implementation
  1529.     virtual CFile* Duplicate() const;
  1530.     virtual LONG Seek(LONG lOff, UINT nFrom);
  1531.     virtual void SetLength(DWORD dwNewLen);
  1532.     virtual DWORD GetLength() const;
  1533.     virtual UINT Read(void* lpBuf, UINT nCount);
  1534.     virtual void Write(const void* lpBuf, UINT nCount);
  1535.     virtual void LockRange(DWORD dwPos, DWORD dwCount);
  1536.     virtual void UnlockRange(DWORD dwPos, DWORD dwCount);
  1537.     virtual void Abort();
  1538.     virtual void Flush();
  1539.     virtual void Close();
  1540.  
  1541. protected:
  1542.     CString m_strStorageName;
  1543. };
  1544.  
  1545. #if !defined(_WIN32_WCE)
  1546. /////////////////////////////////////////////////////////////////////////////
  1547. // CMonikerFile - implementation of COleStreamFile that uses an IMoniker to
  1548. //                get the IStream
  1549.  
  1550. class CMonikerFile: public COleStreamFile
  1551. {
  1552.     DECLARE_DYNAMIC(CMonikerFile)
  1553.  
  1554. public:
  1555.     CMonikerFile();
  1556.  
  1557.     virtual BOOL Open(LPCTSTR lpszURL, CFileException* pError=NULL);
  1558.     // Uses synchronous URLMonikers to create a moniker.
  1559.     // Opens the URL specified.
  1560.     // If provided, pError will be set in case of error.
  1561.     // Return value: TRUE if successful, FALSE otherwise.
  1562.  
  1563.     virtual BOOL Open(IMoniker* pMoniker, CFileException* pError=NULL);
  1564.     // Binds to the provided moniker to obtain a stream.
  1565.     // If provided, pError will be set in case of error.
  1566.     // Return value: TRUE if successful, FALSE otherwise.
  1567.  
  1568.     virtual void Close();
  1569.     // Detaches the stream, Release()s it, and the moniker.  Close may be
  1570.     // called on unopened, or already closed streams.
  1571.  
  1572.     BOOL Detach(CFileException* pError = NULL);
  1573.     // Closes the stream.  If there is an error when closing, then the
  1574.     // error code will be placed in pError and the function will return FALSE.
  1575.  
  1576.     IMoniker* GetMoniker() const;
  1577.     // Returns the current moniker.  The moniker returned is not AddRef()'ed.
  1578.  
  1579. protected:
  1580. // Overidables
  1581.     IBindCtx* CreateBindContext(CFileException* pError);
  1582.     // A hook so users can provide a particular IBindCtx, potentially one
  1583.     // on which the user has registered one or more objects.
  1584.  
  1585. // Implementation
  1586. protected:
  1587.     virtual BOOL Open(LPCTSTR lpszUrl, IBindHost* pBindHost,
  1588.         IBindStatusCallback* pBSC, IBindCtx* pBindCtx, CFileException* pError);
  1589.     BOOL Attach(LPCTSTR lpszUrl, IBindHost* pBindHost,
  1590.         IBindStatusCallback* pBSC, IBindCtx* pBindCtx, CFileException* pError);
  1591.     virtual BOOL Open(IMoniker* pMoniker, IBindHost* pBindHost,
  1592.         IBindStatusCallback* pBSC, IBindCtx* pBindCtx, CFileException* pError);
  1593.  
  1594.     BOOL Attach(IMoniker* pMoniker, IBindHost* pBindHost,
  1595.         IBindStatusCallback* pBSC, IBindCtx* pBindCtx, CFileException* pError);
  1596.  
  1597.     virtual BOOL PostBindToStream(CFileException* pError);
  1598.  
  1599.     static IBindHost* CreateBindHost();
  1600. public:
  1601.     virtual ~CMonikerFile();
  1602.     // Closes the stream, and releases the moniker if needed.
  1603.  
  1604.     virtual void Flush();
  1605.  
  1606. #ifdef _DEBUG
  1607.     virtual void AssertValid() const;
  1608.     virtual void Dump(CDumpContext& dc) const;
  1609.     // Calls COleStreamFile::Dump(), and prints out moniker value.
  1610. #endif
  1611.  
  1612. protected:
  1613.     IPTR(IMoniker) m_Moniker;
  1614.     // The moniker provided or created to which this class is bound.
  1615.  
  1616.     CMonikerFile(const CMonikerFile&);
  1617.     // Prevents copying.
  1618. };
  1619.  
  1620. /////////////////////////////////////////////////////////////////////////////
  1621. // CAsyncMonikerFile - implementation of COleStreamFile that uses an
  1622. //                     asynchronous IMoniker to get the IStream
  1623.  
  1624. class _AfxBindStatusCallback; // Forward declaration
  1625.  
  1626. class CAsyncMonikerFile: public CMonikerFile
  1627. {
  1628.     DECLARE_DYNAMIC(CAsyncMonikerFile)
  1629.  
  1630. public:
  1631.     CAsyncMonikerFile();
  1632.     // Creates the IBindStatusCallback used internally to provide asynchronous
  1633.     // operation.
  1634.  
  1635.     //All Open overloads call one of these two.
  1636.     virtual BOOL Open(LPCTSTR lpszURL, IBindHost* pBindHost,
  1637.         CFileException* pError=NULL);
  1638.     virtual BOOL Open(IMoniker* pMoniker, IBindHost* pBindHost,
  1639.         CFileException* pError=NULL);
  1640.  
  1641.     //Open overloads that take monikers
  1642.     virtual BOOL Open(IMoniker* pMoniker, CFileException* pError=NULL);
  1643.     virtual BOOL Open(IMoniker* pMoniker, IServiceProvider* pServiceProvider,
  1644.         CFileException* pError=NULL);
  1645.     virtual BOOL Open(IMoniker* pMoniker, IUnknown* pUnknown,
  1646.         CFileException* pError=NULL);
  1647.  
  1648.     //Open overloads that take strings
  1649.     virtual BOOL Open(LPCTSTR lpszURL, CFileException* pError=NULL);
  1650.     virtual BOOL Open(LPCTSTR lpszURL, IServiceProvider* pServiceProvider,
  1651.         CFileException* pError=NULL);
  1652.     virtual BOOL Open(LPCTSTR lpszURL, IUnknown* pUnknown,
  1653.         CFileException* pError=NULL);
  1654.  
  1655.     virtual void Close();
  1656.  
  1657.     IBinding* GetBinding() const;
  1658.     // Returns the binding provided when the asychronous transfer begins.
  1659.     // With the IBinding*, the user may abort, or pause the transfer.
  1660.     // NULL may be returned if for any reason the transfer could not be
  1661.     // made asynchronous, or if the IBinding* has not yet been provided by
  1662.     // the system.
  1663.  
  1664.     FORMATETC* GetFormatEtc() const;
  1665.     // Returns the FORMATETC for the currently opened stream.  NULL will be
  1666.     // returned if this is called from outside the context of OnDataAvailable.
  1667.     // If you want to keep the FORMATETC beyond this call, make a copy of it.
  1668.     // The FORMATETC indicates the format of the data in the stream.
  1669.  
  1670. protected:
  1671. // Overidables
  1672.     virtual IUnknown* CreateBindStatusCallback(IUnknown* pUnkControlling);
  1673.  
  1674.     virtual DWORD GetBindInfo() const;
  1675.     // Returns the settings returned by IBindStatusCallback::GetBindInfo.
  1676.     // The default values returned should work for most cases and should not
  1677.     // be changed lightly.
  1678.  
  1679.     virtual LONG GetPriority() const;
  1680.     // Returns the priority at which the asynchronous transfer will take
  1681.     // place.  The value is one of the standard thread priority flags.
  1682.     // By default THREAD_PRIORITY_NORMAL is returned.
  1683.  
  1684.     virtual void OnDataAvailable(DWORD dwSize, DWORD bscfFlag);
  1685.     // Called when there is data available to be read.  dwSize indicates
  1686.     // the cumulative number of bytes which can be read.  The bscfFlag may be used
  1687.     // to identify first, last, and intermediate blocks of data.
  1688.  
  1689.     virtual void OnLowResource();
  1690.     // This is called when resources are low.
  1691.  
  1692.     virtual void OnStartBinding();
  1693.     // Called when the binding is starting up.
  1694.  
  1695.     virtual void OnProgress(ULONG ulProgress, ULONG ulProgressMax,
  1696.         ULONG ulStatusCode, LPCTSTR szStatusText);
  1697.  
  1698.     virtual void OnStopBinding(HRESULT hresult, LPCTSTR szError);
  1699.     // Called when the transfer is stopped.  This function releases the
  1700.     // IBinding and should nearly always be call when overidden.
  1701.  
  1702. // Implementation
  1703. public:
  1704.     virtual ~CAsyncMonikerFile();
  1705. #ifdef _DEBUG
  1706.     virtual void AssertValid() const;
  1707.     virtual void Dump(CDumpContext& dc) const;
  1708.     // Calls CMonikerFile::Dump(), and prints out IBinding,
  1709.     // IBindStatusCallback, and m_pFormatEtc values.
  1710. #endif
  1711.     virtual UINT Read(void* lpBuf, UINT nCount);
  1712.  
  1713. protected:
  1714.     friend class _AfxBindStatusCallback;
  1715.     _AfxBindStatusCallback* m_pAfxBSCCurrent;
  1716.     BOOL m_bStopBindingReceived;
  1717.     void EndCallbacks();
  1718.  
  1719.     IPTR(IBinding) m_Binding;
  1720.     FORMATETC* m_pFormatEtc;
  1721.  
  1722.     void SetBinding(IBinding* pBinding);
  1723.     // Sets and AddRefs m_Binding
  1724.  
  1725.     void SetFormatEtc(FORMATETC* pFormatEtc);
  1726.     // Sets the FORMATETC for the current stream.
  1727.  
  1728.     virtual BOOL PostBindToStream(CFileException* pError);
  1729. };
  1730.  
  1731. /////////////////////////////////////////////////////////////////////////////
  1732. // COleDropSource (advanced drop source support)
  1733.  
  1734. class COleDropSource : public CCmdTarget
  1735. {
  1736. // Constructors
  1737. public:
  1738.     COleDropSource();
  1739.  
  1740. // Overridables
  1741.     virtual SCODE QueryContinueDrag(BOOL bEscapePressed, DWORD dwKeyState);
  1742.     virtual SCODE GiveFeedback(DROPEFFECT dropEffect);
  1743.     virtual BOOL OnBeginDrag(CWnd* pWnd);
  1744.  
  1745. // Implementation
  1746. public:
  1747. #ifdef _DEBUG
  1748.     virtual void Dump(CDumpContext& dc) const;
  1749. #endif
  1750.  
  1751. public:
  1752.     BEGIN_INTERFACE_PART(DropSource, IDropSource)
  1753.         INIT_INTERFACE_PART(COleDropSource, DropSource)
  1754.         STDMETHOD(QueryContinueDrag)(BOOL, DWORD);
  1755.         STDMETHOD(GiveFeedback)(DWORD);
  1756.     END_INTERFACE_PART(DropSource)
  1757.  
  1758.     DECLARE_INTERFACE_MAP()
  1759.  
  1760.     CRect m_rectStartDrag;  // when mouse leaves this rect, drag drop starts
  1761.     BOOL m_bDragStarted;    // has drag really started yet?
  1762.     DWORD m_dwButtonCancel; // which button will cancel (going down)
  1763.     DWORD m_dwButtonDrop;   // which button will confirm (going up)
  1764.  
  1765.     // metrics for drag start determination
  1766.     static AFX_DATA UINT nDragMinDist;  // min. amount mouse must move for drag
  1767.     static AFX_DATA UINT nDragDelay;    // delay before drag starts
  1768.  
  1769.     friend class COleDataSource;
  1770. };
  1771.  
  1772. /////////////////////////////////////////////////////////////////////////////
  1773. // COleDropTarget (advanced drop target support)
  1774.  
  1775. class COleDropTarget : public CCmdTarget
  1776. {
  1777. // Constructors
  1778. public:
  1779.     COleDropTarget();
  1780.  
  1781. // Operations
  1782.     BOOL Register(CWnd* pWnd);
  1783.     virtual void Revoke();  // virtual for implementation
  1784.  
  1785. // Overridables
  1786.     virtual DROPEFFECT OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject,
  1787.         DWORD dwKeyState, CPoint point);
  1788.     virtual DROPEFFECT OnDragOver(CWnd* pWnd, COleDataObject* pDataObject,
  1789.         DWORD dwKeyState, CPoint point);
  1790.     virtual BOOL OnDrop(CWnd* pWnd, COleDataObject* pDataObject,
  1791.         DROPEFFECT dropEffect, CPoint point);
  1792.     virtual DROPEFFECT OnDropEx(CWnd* pWnd, COleDataObject* pDataObject,
  1793.         DROPEFFECT dropDefault, DROPEFFECT dropList, CPoint point);
  1794.     virtual void OnDragLeave(CWnd* pWnd);
  1795.     virtual DROPEFFECT OnDragScroll(CWnd* pWnd, DWORD dwKeyState,
  1796.         CPoint point);
  1797.  
  1798. // Implementation
  1799. public:
  1800.     virtual ~COleDropTarget();
  1801. #ifdef _DEBUG
  1802.     virtual void AssertValid() const;
  1803.     virtual void Dump(CDumpContext& dc) const;
  1804. #endif
  1805.  
  1806. protected:
  1807.     HWND m_hWnd;            // HWND this IDropTarget is attached to
  1808.     LPDATAOBJECT m_lpDataObject;    // != NULL between OnDragEnter, OnDragLeave
  1809.     UINT m_nTimerID;        // != MAKEWORD(-1, -1) when in scroll area
  1810.     DWORD m_dwLastTick;     // only valid when m_nTimerID valid
  1811.     UINT m_nScrollDelay;    // time to next scroll
  1812.  
  1813.     // metrics for drag-scrolling
  1814.     static AFX_DATA int nScrollInset;
  1815.     static AFX_DATA UINT nScrollDelay;
  1816.     static AFX_DATA UINT nScrollInterval;
  1817.  
  1818.     // implementation helpers
  1819.     void SetupTimer(CView* pView, UINT nTimerID);
  1820.     void CancelTimer(CWnd* pWnd);
  1821.  
  1822. // Interface Maps
  1823. public:
  1824.     BEGIN_INTERFACE_PART(DropTarget, IDropTarget)
  1825.         INIT_INTERFACE_PART(COleDropTarget, DropTarget)
  1826.         STDMETHOD(DragEnter)(LPDATAOBJECT, DWORD, POINTL, LPDWORD);
  1827.         STDMETHOD(DragOver)(DWORD, POINTL, LPDWORD);
  1828.         STDMETHOD(DragLeave)();
  1829.         STDMETHOD(Drop)(LPDATAOBJECT, DWORD, POINTL pt, LPDWORD);
  1830.     END_INTERFACE_PART(DropTarget)
  1831.  
  1832.     DECLARE_INTERFACE_MAP()
  1833. };
  1834.  
  1835. /////////////////////////////////////////////////////////////////////////////
  1836. // COleMessageFilter (implements IMessageFilter)
  1837.  
  1838. class COleMessageFilter : public CCmdTarget
  1839. {
  1840. // Constructors
  1841. public:
  1842.     COleMessageFilter();
  1843.  
  1844. // Operations
  1845.     BOOL Register();
  1846.     void Revoke();
  1847.  
  1848.     // for controlling the busy state of the server application (called app)
  1849.     virtual void BeginBusyState();
  1850.     virtual void EndBusyState();
  1851.     void SetBusyReply(SERVERCALL nBusyReply);
  1852.  
  1853.     // for controlling actions taken against rejected/retried calls
  1854.     void SetRetryReply(DWORD nRetryReply = 0);
  1855.         // only used when the "not responding" dialog is disabled
  1856.     void SetMessagePendingDelay(DWORD nTimeout = 5000);
  1857.         // used to determine amount of time before significant message
  1858.     void EnableBusyDialog(BOOL bEnableBusy = TRUE);
  1859.     void EnableNotRespondingDialog(BOOL bEnableNotResponding = TRUE);
  1860.         // used to enable/disable the two types of busy dialogs
  1861.  
  1862. // Overridables
  1863.     virtual BOOL OnMessagePending(const MSG* pMsg);
  1864.         // return TRUE to eat the message (usually only if processed)
  1865.  
  1866. // Implementation
  1867. public:
  1868. #ifdef _DEBUG
  1869.     virtual void AssertValid() const;
  1870.     virtual void Dump(CDumpContext& dc) const;
  1871. #endif
  1872.     virtual ~COleMessageFilter();
  1873.     virtual BOOL IsSignificantMessage(MSG* pMsg);
  1874.         // determine if any significant messages are present in the queue
  1875.     virtual int OnBusyDialog(HTASK htaskBusy);
  1876.     virtual int OnNotRespondingDialog(HTASK htaskBusy);
  1877.         // these functions display the busy dialog
  1878.  
  1879. protected:
  1880.     BOOL m_bRegistered;
  1881.     LONG m_nBusyCount;  // for BeginBusyState & EndBusyState
  1882.     BOOL m_bEnableBusy;
  1883.     BOOL m_bEnableNotResponding;
  1884.     BOOL m_bUnblocking;
  1885.     DWORD m_nRetryReply;    // only used if m_bEnableNotResponding == FALSE
  1886.     DWORD m_nBusyReply;
  1887.     DWORD m_nTimeout;
  1888.  
  1889. // Interface Maps
  1890. public:
  1891.     BEGIN_INTERFACE_PART(MessageFilter, IMessageFilter)
  1892.         INIT_INTERFACE_PART(COleMessageFilter, MessageFilter)
  1893.         STDMETHOD_(DWORD, HandleInComingCall)(DWORD, HTASK, DWORD,
  1894.             LPINTERFACEINFO);
  1895.         STDMETHOD_(DWORD, RetryRejectedCall)(HTASK, DWORD, DWORD);
  1896.         STDMETHOD_(DWORD, MessagePending)(HTASK, DWORD, DWORD);
  1897.     END_INTERFACE_PART(MessageFilter)
  1898.  
  1899.     DECLARE_INTERFACE_MAP()
  1900. };
  1901. #endif // _WIN32_WCE
  1902.  
  1903. /////////////////////////////////////////////////////////////////////////////
  1904. // message map entries for OLE verbs
  1905.  
  1906. #define ON_STDOLEVERB(iVerb, memberFxn) \
  1907.     { 0xC002, 0, (UINT)iVerb, (UINT)iVerb, (UINT)-1, \
  1908.         (AFX_PMSG)(BOOL (AFX_MSG_CALL CCmdTarget::*)(LPMSG, HWND, LPCRECT))&memberFxn },
  1909.  
  1910. #define ON_OLEVERB(idsVerbName, memberFxn) \
  1911.     { 0xC002, 0, 1, 1, idsVerbName, \
  1912.         (AFX_PMSG)(BOOL (AFX_MSG_CALL CCmdTarget::*)(LPMSG, HWND, LPCRECT))&memberFxn },
  1913.  
  1914. /////////////////////////////////////////////////////////////////////////////
  1915. // global helpers and debugging
  1916.  
  1917. void AFXAPI AfxOleSetEditMenu(COleClientItem* pClient, CMenu* pMenu,
  1918.     UINT iMenuItem, UINT nIDVerbMin, UINT nIDVerbMax = 0, UINT nIDConvert = 0);
  1919.  
  1920. #ifdef _DEBUG
  1921. // Mapping SCODEs to readable text
  1922. LPCTSTR AFXAPI AfxGetFullScodeString(SCODE sc);
  1923. LPCTSTR AFXAPI AfxGetScodeString(SCODE sc);
  1924. LPCTSTR AFXAPI AfxGetScodeRangeString(SCODE sc);
  1925. LPCTSTR AFXAPI AfxGetSeverityString(SCODE sc);
  1926. LPCTSTR AFXAPI AfxGetFacilityString(SCODE sc);
  1927.  
  1928. // Mapping IIDs to readable text
  1929. LPCTSTR AFXAPI AfxGetIIDString(REFIID iid);
  1930. #endif
  1931.  
  1932. /////////////////////////////////////////////////////////////////////////////
  1933. // Inline function declarations
  1934.  
  1935. #ifdef _AFX_PACKING
  1936. #pragma pack(pop)
  1937. #endif
  1938.  
  1939. #ifdef _AFX_ENABLE_INLINES
  1940. #include <afxole.inl>
  1941. #undef _AFXOLE_INLINE
  1942. #undef _AFXOLECLI_INLINE
  1943. #undef _AFXOLESVR_INLINE
  1944. #undef _AFXOLEDOBJ_INLINE
  1945. #undef _AFXOLEMONIKER_INLINE
  1946. #endif
  1947.  
  1948. #undef AFX_DATA
  1949. #define AFX_DATA
  1950.  
  1951. #ifdef _AFX_MINREBUILD
  1952. #pragma component(minrebuild, on)
  1953. #endif
  1954. #ifndef _AFX_FULLTYPEINFO
  1955. #pragma component(mintypeinfo, off)
  1956. #endif
  1957.  
  1958. #endif //__AFXOLE_H__
  1959.  
  1960. /////////////////////////////////////////////////////////////////////////////x
  1961.